package com.rockwell.sniffyHunter.test;

import com.rockwell.sniffyhunter.utils.IStateMachine;
import com.rockwell.sniffyhunter.utils.IStateObject;

import android.test.AndroidTestCase;

public class UnitTestLooper extends AndroidTestCase {

	private static final int MAX_LOOP_COUNT = 100;
	
	public UnitTestLooper() {
		super();
	}

	protected void loopUntilCondition(IStateObject stateObject, IStateMachine expectedState) {
		int count = MAX_LOOP_COUNT;
		while (stateObject.getStateMachine() != expectedState && count > 0) {
			stateObject.PerformAction();
			count--;
		}
	}

}